package cn.jbolt.ai.core.chain.node.action.klb;

import cn.jbolt.util.JSONUtil;
import com.fasterxml.jackson.databind.JsonNode;

public class KlbSearchNodeConfig {

    /**
     * 知识库id
     */
    private Long klbId;


    /**
     * 知识库查询文本 来源字段
     */
    private String inputField;

    /**
     * 知识库结果 存储字段
     */
    private String outputField;

    /**
     * 每次查询要的结果 条数
     */
    private int limit = 6;

    /**
     * 选取的结果要求最小分数
     */
    private double minScore = 0.6;

    /**
     * 是否输出到响应
     */
    private boolean outputToResponse = false;



    public static KlbSearchNodeConfig from(JsonNode jsonNode) {
        return JSONUtil.toObject(jsonNode, KlbSearchNodeConfig.class);

    }

    //  转换为 JSON 字符串的方法
    public static JsonNode getDefaultConfig() {

        return JSONUtil.toJsonObject(new KlbSearchNodeConfig());
    }

    public Long getKlbId() {
        return klbId;
    }

    public void setKlbId(Long klbId) {
        this.klbId = klbId;
    }


    public String getInputField() {
        return inputField;
    }

    public void setInputField(String inputField) {
        this.inputField = inputField;
    }

    public String getOutputField() {
        return outputField;
    }

    public void setOutputField(String outputField) {
        this.outputField = outputField;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public boolean isOutputToResponse() {
        return outputToResponse;
    }
    public void setOutputToResponse(boolean outputToResponse) {
        this.outputToResponse = outputToResponse;
    }

    public double getMinScore() {
        return minScore;
    }

    public void setMinScore(double minScore) {
        this.minScore = minScore;
    }
}
